import 'package:base_flutter/base_flutter.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';

import '../../net/response/activity/actvity_recommend_list_data.dart';
import '../../res/colors.dart';
import '../../viewmodel/new_activity/old_sign_in_view_model.dart';
import '../../widgets/activity_widget.dart';
import '../../widgets/title_value_widget.dart';
import '../select_multi_old_page.dart';
import '../select_old_page.dart';

class OldSignInPage extends BaseStatefulMvvmWidget{
  final ActvityRecommendListData item;

  OldSignInPage(this.item);

  @override
  State<StatefulWidget> createState() => _OldSignInState();

}

class _OldSignInState extends BaseMvvmState<OldSignInViewModel,OldSignInPage>{
  @override
  Widget buildLoadingContentView() {
    return Column(
      children: [
        ListView(
          children: [
            TitleValueWidget("长者姓名",hint: '请选择',isRequired: true,text: viewModel.selectName,).onTap(() {
              viewModel.selectOld();

            }),
            ...ActivityWidget.activityIndfoWidget(viewModel.contentList),
          ],
        ).setWeight(1),

        TextButton(onPressed: (){
          viewModel.submitEnroll();
        }, child: CommonText('提交',textColor: Colors.white),
          style: ButtonStyle(
              backgroundColor: WidgetStateProperty.all(Colours.app_main),
              minimumSize: WidgetStateProperty.all(Size.fromHeight(45)),
              shape: WidgetStateProperty.all(StadiumBorder())
          ),).addToContainer(margin: EdgeInsets.symmetric(horizontal: 16,vertical: 10),width: MediaQuery.of(context).size.width)
      ],
    );
  }

  @override
  Widget buildRootView(BuildContext context, Widget loadingContentWidget) {
    return Scaffold(
      appBar: AppBar(title: Text('活动报名'),),
      body: loadingContentWidget,
    );
  }

  @override
  OldSignInViewModel createViewModel() {
    return OldSignInViewModel(context,widget.item);
  }

  @override
  void onRetryClick() {
  }

}